#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include "rngs.h"
#include "testhelpers.c"

void setHand(struct gameState *state){
    state->hand[0][0] = smithy;
    state->handCount[0] = 1;
}

int main(){
    struct gameState *state = malloc(sizeof(struct gameState));
    setState(state);
    resetDeck(state);
    setHand(state);

    resetFlag();

    printf("Testing Smithy card effect\n");

    cardEffect(smithy, 0, 0, 0, state, 0, 0);
    // smithy should add 3 cards to the hand and discard the smithy
    if (state->handCount[0]!=3) // This will fail in my version of the code due to a seeded bug
        assertMessage("Hand Count should be %d, it is %d\n", 3, state->handCount[0]);
    if (state->playedCardCount!=1)
        assertMessage("Played Card Count should be %d, it is %d\n", 1, state->playedCardCount);
    if (state->playedCards[0]!=smithy)
        assertMessage("Last Played card should be %d, it is %d\n", smithy, state->playedCards[0]);

    if(testState() == 0)
        printf("Smithy Card Effect Test Passed\n");
    else
        printf("Smithy Card Effect Test Failed\n");

    free(state);
    return 0;
}
